﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Office = Microsoft.Office.Core;
using Microsoft.Office.Tools.Word;
using Microsoft.Office.Tools.Word.Extensions;
using Microsoft.Office.Tools;
using Word = Microsoft.Office.Interop.Word;

namespace UCSD_BioLit
{
    internal class DocumentWrapper
    {
        private Microsoft.Office.Interop.Word.Document wrappedDocument;
        private CustomTaskPane ctp = null;
        private BioLitTaskPane bltp = new BioLitTaskPane();

        public DocumentWrapper(Microsoft.Office.Interop.Word.Document theDoc)
        {
            wrappedDocument = theDoc;
            WireDocumentEvents();
            CreateTaskPane();
        }


        private void CreateTaskPane()
        {
            ctp = Globals.ThisAddIn.CustomTaskPanes.Add(bltp, "Ontology Term Viewer", wrappedDocument.ActiveWindow);
        }
        private void WireDocumentEvents()
        {

        }
        
        internal bool ISBioLitDoc
        {
            get
            {
                return true;
            }
        }
        internal Microsoft.Office.Interop.Word.Document Document
        {
            get
            {
                return wrappedDocument;
            }
        }

        internal CustomTaskPane TaskPane
        {
            get
            {
                return ctp;
            }
            set
            {
                ctp = value;
            }
        }

        internal BioLitTaskPane TaskPaneControl
        {
            get { return bltp; }
        }

        internal void Cleanup()
        {
            ctp = null;
            wrappedDocument = null;
        }

        internal void LookupTerm(string p)
        {
            ctp.Visible = true;
            bltp.LookupTerm(p);
        }

        

        
    }
}
